// import { createPost } from "@/utils/request";
import type { PagingParames, PagingResponse } from "../index.d";
import type { SolutionItem, CreateTaskParams, TestCaseTreeItem, TestCaseItem } from "./index.d";
import type { nodeItem } from "mctp-platform/src/components/index";
import type { TreeKey } from "element-plus/lib";

// const solutionPath = "/api/Solution/SendCommand";
// const createTaskPath = "/api/CreateTask/SendCommand";
// const taskPath = "/api/Task/SendCommand";
// 模块ID（替代原来的path，对应CalibrationModule的config.id）
const createTaskModuleId = "CreateTaskForm";
// const solutionFormModuleId = "SolutionForm";
import { createCommand } from '../../commandHelper';

// ----------------------------------- 新建任务 --------------------------------------------

/**
 * @description 跳转测试/添加任务页面
 */
export const routerLinkTestView = createCommand<{}, never>(createTaskModuleId, { commandName: "RouterLink" });

/**
 * @description: 根据条件获取方案集合
 */
export const getSolutionsByCondition = createCommand<PagingParames, PagingResponse<SolutionItem[]>>(createTaskModuleId, { commandName: "GetSolutionsByCondition" });

/**
 * @description: 开始创建任务
 */
export const startCreateTask = createCommand<CreateTaskParams, never>(createTaskModuleId,{ commandName: "StartCreateTask" });

/**
 * @description: 取消创建任务
 */
export const cancelCreateTask = createCommand<never, never>(createTaskModuleId,{ commandName: "CancelCreateTask" });

/**
 * @description: 完成创建任务
 */
export const completeCreateTask = createCommand<never, never>(createTaskModuleId,{ commandName: "CompleteCreateTask" });

/**
 * @description: 获取测试树结构目录
 */
export const getTestCaseTree = createCommand<{}, TestCaseTreeItem | TestCaseItem>(createTaskModuleId, { command: "GetTestCaseTree" });

/**
 * @description: 保存选择的测试用例
 */
export const setSelectCases = createCommand<{ testCaseIds: TreeKey[] }, never>(createTaskModuleId, { command: "SetSelectCases" });

/**
 * @description: 获取测试用例配置
 */
export const getTestCaseConfig = createCommand<{ caseId: string }, nodeItem[]>(createTaskModuleId, { command: "GetTestCaseConfig" });

/**
 * @description: 更新测试用例配置
 */
export const updateTestCaseConfig = createCommand<{ caseId: string; config: nodeItem[] }, never>(createTaskModuleId, {
  command: "UpdateTestCaseConfig"
});
